﻿/*
 * timer_2ms.h
 *
 *  Created on: 2019年4月26日
 *      Author: Jinming Chen
 */
#ifndef _TIMER_2MS_H__
#define _TIMER_2MS_H__

#include <stdlib.h>
#include "main.h"

typedef enum{
	TIMER_REG_OK = 0,
	TIMER_REG_ERR,
	TIMER_NO_FIND,
	TIMER_FIND,
	TIMER_UNREG_OK,
	TIMER_OPS_OK,
}TIMER_ERR;

void timer2ms_init(void);
void timer_exec(void);
TIMER_ERR timer_reg_fun(const char *name, uint16_t timer, void (*function)(void *), void *param);
TIMER_ERR timer_unreg_fun(void (*function)(void *));
TIMER_ERR timer_unreg_fun_with_free(void (*function)(void *));
TIMER_ERR timer_retime(void (*function)(void *));
uint8_t timer_search_count(void (*function)(void *));
void timer_interrupt(void);
TIMER_ERR timer_stop(void (*function)(void *));
TIMER_ERR timer_start(void (*function)(void *));

#if	THREAD_STACK_CHECK
uint32_t timer2ms_get_remaining_stack_space(void);
#endif

#endif   //_TIMER_2MS_H__

